package thread;

public class Demo16 {
    public static void main(String[] args)throws InterruptedException {
        Thread mainThread=Thread.currentThread();
        Thread t1=new Thread(()->{
            try{
                System.out.println("开始等待main线程");
                mainThread.join();
                System.out.println("结束等待mian线程");
            }catch (InterruptedException e){
                throw new RuntimeException(e);
            }
        });
        t1.start();
        Thread.sleep(1000);
        System.out.println("main线程结束");
    }
}
